package com.blb.eduadservice.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.blb.common.entity.PromotionAd;
import com.blb.eduadservice.mapper.AdDao;
import com.blb.eduadservice.service.AdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdServiceImpl implements AdService {

    @Autowired
    private AdDao adDao;


    @Cacheable(cacheNames = "ad",key = "T(String).valueOf(#sid)")
    @Override
    public List<PromotionAd> getAdsBySpaceId(Integer sid){
        QueryWrapper<PromotionAd> qw = new QueryWrapper<>();
        qw.eq("space_id", sid);
        return adDao.selectList(qw);
    }
}
